package com.admin.testproject.adapter

import android.content.Context
import android.util.Log
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import com.admin.testproject.R
import com.admin.testproject.Testbean

/**
 * author 吴昶
 * date 2019/6/4
 * 标注
 */
class TestAdapter (context: Context):RecycleBaseAdapter<Testbean>(context){

    override fun getItemLayout(position: Int): Int {
        Log.e("*****","$position")
        return R.layout.layout_recy_item
    }

    override fun initData(viewHolder: BaseViewHolder?, item: Testbean?, position: Int) {
        viewHolder?.getView<TextView>(R.id.tv_item)?.text=item?.title
        viewHolder?.getView<ImageView>(R.id.iv_title)?.setImageResource(item?.image!!)
        viewHolder?.getView<LinearLayout>(R.id.linear_item)?.setOnClickListener {
            onItemClick?.onItemClick(item)
        }
    }

}